home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fritz: All Fritz
/
All Fritz.zip
/
All Fritz
/
FILES
/
PROGMISC
/
PCSSP.LZH
/
PC-SSP.ZIP
/
POLYSPTP.ZIP
/
TLEP.FOR
< prev
Wrap
Text File
|
1985-11-29
|
3KB
|
92 lines
C
C ..................................................................
C
C SUBROUTINE TLEP
C
C PURPOSE
C A SERIES EXPANSION IN LEGENDRE POLYNOMIALS WITH INDEPENDENT
C VARIABLE X IS TRANSFORMED TO A POLYNOMIAL WITH INDEPENDENT
C VARIABLE Z, WHERE X=A*Z+B
C
C USAGE
C CALL TLEP(A,B,POL,N,C,WORK)
C
C DESCRIPTION OF PARAMETERS
C A - FACTOR OF LINEAR TERM IN GIVEN LINEAR TRANSFORMATION
C B - CONSTANT TERM IN GIVEN LINEAR TRANSFORMATION
C POL - COEFFICIENT VECTOR OF POLYNOMIAL (RESULTANT VALUE)
C COEFFICIENTS ARE ORDERED FROM LOW TO HIGH
C N - DIMENSION OF COEFFICIENT VECTORS POL AND C
C C - GIVEN COEFFICIENT VECTOR OF EXPANSION
C COEFFICIENTS ARE ORDERED FROM LOW TO HIGH
C POL AND C MAY BE IDENTICALLY LOCATED
C WORK - WORKING STORAGE OF DIMENSION 2*N
C
C REMARKS
C COEFFICIENT VECTOR C REMAINS UNCHANGED IF NOT COINCIDING
C WITH COEFFICIENT VECTOR POL.
C OPERATION IS BYPASSED IN CASE N LESS THAN 1.
C THE LINEAR TRANSFORMATION X=A*Z+B OR Z=(1/A)(X-B) TRANSFORMS
C THE RANGE (-1,+1) IN X TO THE RANGE (ZL,ZR) IN Z, WHERE
C ZL=-(1+B)/A AND ZR=(1-B)/A.
C FOR GIVEN ZL, ZR WE HAVE A=2/(ZR-ZL) AND B=-(ZR+ZL)/(ZR-ZL)
C
C SUBROUTINES AND FUNCTION SUBPROGRAMS REQUIRED
C NONE
C
C METHOD
C THE TRANSFORMATION IS BASED ON THE RECURRENCE EQUATION
C FOR LEGENDRE POLYNOMIALS P(N,X)
C P(N+1,X)=2*X*P(N,X)-P(N-1,X)-(X*P(N,X)-P(N-1,X))/(N+1),
C WHERE THE FIRST TERM IN BRACKETS IS THE INDEX,
C THE SECOND IS THE ARGUMENT.
C STARTING VALUES ARE P(0,X)=1, P(1,X)=X.
C THE TRANSFORMATION IS IMPLICITLY DEFINED BY MEANS OF
C X=A*Z+B TOGETHER WITH
C SUM(POL(I)*Z**(I-1), SUMMED OVER I FROM 1 TO N)
C =SUM(C(I)*P(I-1,X), SUMMED OVER I FROM 1 TO N).
C
C ..................................................................
C
SUBROUTINE TLEP(A,B,POL,N,C,WORK)
C
DIMENSION POL(1),C(1),WORK(1)
C
C TEST OF DIMENSION
IF(N-1)2,1,3
C
C DIMENSION LESS THAN 2
1 POL(1)=C(1)
2 RETURN
C
3 POL(1)=C(1)+B*C(2)
POL(2)=A*C(2)
IF(N-2)2,2,4
C
C INITIALIZATION
4 WORK(1)=1.
WORK(2)=B
WORK(3)=0.
WORK(4)=A
FI=1.
C
C CALCULATE COEFFICIENT VECTOR OF NEXT LEGENDRE POLYNOMIAL
C AND ADD MULTIPLE OF THIS VECTOR TO POLYNOMIAL POL
DO 6 J=3,N
FI=FI+1.
Q=1./FI-1.
Q1=1.-Q
P=0.
C
DO 5 K=2,J
H=(A*P+B*WORK(2*K-2))*Q1+Q*WORK(2*K-3)
P=WORK(2*K-2)
WORK(2*K-2)=H
WORK(2*K-3)=P
5 POL(K-1)=POL(K-1)+H*C(J)
WORK(2*J-1)=0.
WORK(2*J)=A*P*Q1
6 POL(J)=C(J)*WORK(2*J)
RETURN
END